#!/Users/timm/opt/gawk/bin/gawk -f 
 
# percentiles.awk
# Revision: 285
# Built by timm on Thu Jun 30 16:27:14 EDT 2011.

#   _ _ _                                               ((
#  |=|=|=|.----------------------------------------.    _))_
#  |-|-|-|| AWK code of a tiny book on data mining | ___\__/)_
#  |_|_|_|'----------------------------------------| |_|_~~_|_|

# This file is part of TINY.
#
# TINY is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# TINY is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
#  along with TINY.  If not, see <http://www.gnu.org/licenses/>.

 @include "lib.awk"
 @include "percentile.awk"
 BEGIN { OFS=FS="," }
       { gsub(/[ \t]*/,"")
         Key=$2
		 for(I=3;I<NF;I++) Key= Key OFS $I
		 Results[$1][Key]=$NF
		 Results[_][Key]=$NF
        }
 END   {for(Data in Results)
              for(Key in Results[Data]) {
					asort(Results[Data][Key],All)
                    quartiles(All)
       }}

